import glob
files = glob.glob('./**/*.m', recursive=True)
c = 0
for file in files:
    # print(file)
    lines = []
    try:
        with open(file, 'r', encoding='utf-8') as f:
            content = f.read()
            lines = content.splitlines()
            # print('len of lines:', len(lines))
    except Exception as e:
        print('err file:', file)
        print(e)
        with open(file, 'r+', encoding='gb18030') as f:
            content = f.read()
            lines = content.splitlines()
            # print('len of lines:', len(lines))
        
    for line in lines:
        line = line.strip()
        if line.startswith('%'):
            continue
        if len(line) > 5:
            c += 1
    
print('c:', c)